home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-18 / bklbat.zip / BKL-ALT.BAT < prev    next >
DOS Batch File  |  1992-02-04  |  3KB  |  104 lines

  1. echo off
  2. cls
  3. if not %1!==?! goto start
  4. echo BKL-ALT.BAT   Dan Goodell   12/91   (version 1)
  5. echo  
  6. echo    This batch file will backup assorted files and/or directories that are
  7. echo  specified in a .LST (list) file.  The list file must be on the specified
  8. echo  drive where the .LZH backup file will be recorded.  The date stamp of an
  9. echo  .UPD (update) directory entry will be recorded with the date and time of
  10. echo  the backup.
  11. echo    This batch file is designed around the free file compression and
  12. echo  uncompression utility LHA.EXE.
  13. echo  
  14. echo  (This version is capable of chaining errors from "COMMAND /C" calls.)
  15. echo  (Use this version with DOS 3.2 or earlier.)
  16. echo  
  17. goto syntax
  18.  
  19. :start
  20.    if %1!==chain! set chain=Y
  21.    if %1!==CHAIN! set chain=Y
  22.    if %chain%!==Y! shift
  23.    for %%d in (a: A: b: B:) do if %%d!==%2! set drv=%2
  24.    if %drv%!==! goto noparm
  25. :pack
  26.    echo checking drive %drv% for %1.LST file...
  27.  
  28.    rem ----remove next two lines if CHKDRV.COM not used-----
  29.    CHKDRV %drv%
  30.    if errorlevel 2 goto baddrv
  31.  
  32.    if not exist %drv%\%1.lst goto baddisk
  33.    LHA u /x1 /z2 %drv%%1.lzh @%drv%%1.lst /wC:
  34.    if errorlevel 2 goto packerr
  35. :packdone
  36.    echo  
  37.    echo updating .UPD stamp...
  38.    rem > %drv%\%1.upd
  39.    echo %1 files backup completed.
  40.    echo  
  41.    goto errors
  42. :baddrv
  43.    echo  
  44.    echo ERROR!  Drive %drv% not ready.  Unable to backup %1 files.
  45.    echo  
  46.    if exist bkerr.err goto baddrv1
  47.    echo set err=Error list: >bkerr.err
  48. :baddrv1
  49.    echo set err=%%err%% %1 >>bkerr.err
  50.    goto errors
  51. :baddisk
  52.    echo  
  53.    echo ERROR!  Disk in drive %drv% does not contain %1.LST backup list.
  54.    echo Unable to backup %1 files.
  55.    echo  
  56.    if exist bkerr.err goto baddisk1
  57.    echo set err=Error list: >bkerr.err
  58. :baddisk1
  59.    echo set err=%%err%% %1 >>bkerr.err
  60.    goto errors
  61. :packerr
  62.    echo  
  63.    echo ERROR!  LHA unable to backup %1 files.
  64.    echo  
  65.    if exist bkerr.err goto packerr1
  66.    echo set err=Error list: >bkerr.err
  67. :packerr1
  68.    echo set err=%%err%% %1 >>bkerr.err
  69.    goto errors
  70. :errors
  71.    if %chain%!==Y! goto end
  72.    if not exist bkerr.err goto end
  73.    echo  
  74.    echo WARNING!  The following backups were not completed due to errors:
  75.    echo echo off >>bkerr.err
  76.    echo ctty con >>bkerr.err
  77.    echo echo %%err%%>>bkerr.err
  78.    echo set err=>>bkerr.err
  79.    ctty nul
  80.    ren bkerr.err bkerr.bat
  81.    c:\command /c bkerr
  82.    del bkerr.bat
  83.    ctty con
  84.    echo  
  85.    goto end
  86. :noparm
  87.    echo  
  88.    echo ERROR!  Incorrect parameters.
  89.    echo  command: BKL-ALT %1 %drv%
  90.    echo  
  91. :syntax
  92.    echo  BKL-ALT.BAT backup program
  93.    echo  Syntax: BKL-ALT [chain] list d:
  94.    echo  where:                       d: = destination drive of backup (A: or B:)
  95.    echo                          list    = name of backup list (on dest drive)
  96.    echo                   chain          = optional parameter used when calling
  97.    echo                                    BKL.BAT from a batch file to retain a
  98.    echo                                    running error list of incomplete backups
  99.    echo  
  100. :end
  101.    set chain=
  102.    set drv=
  103.  
  104.